package com.careerraiser.testing;

import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
import java.util.Iterator;

import com.careerraiser.child.ComparableDog;
import com.careerraiser.child.Dog;

public class ComparatorTest {

	public static void main(String[] args) {
		ArrayList<Dog> dogList2=new ArrayList<Dog>();
		Dog dog1 =new ComparableDog("1Dog",1);
		Dog dog2 =new ComparableDog("ADog",2);
		Dog dog4 =new ComparableDog("4Dog",4);
		Dog dog3 =new ComparableDog("3Dog",5);
		
		Dog dog41 =new ComparableDog("4Dog1",4);
		
		System.out.println("List add output : "+dogList2.add(dog4));
		System.out.println(dogList2.add(dog2));
		System.out.println(dogList2.add(dog1));
		System.out.println(dogList2.add(dog3));
		System.out.println(dogList2.add(dog41));
		System.out.println("------------before sort--------------");
		for (Dog dog : dogList2) {
			System.out.println(dog.getName());
		}
		
		Collections.sort(dogList2, new AnimalComparator());
System.out.println("-----------After sort--------------------");

		for (Dog dog : dogList2) {
			System.out.println(dog.getName());
		}

		Iterator itr = dogList2.iterator();
	}
	
}
